import {LOGIN,LOGOUT,LOGIN_SUCCESS,LOGIN_FAIL ,BASICINFO} from '../constants/login'
// import api from '../services/api'
// import { parse_lrc } from '../utils/common'


const INITIAL_STATE = {
    num: 0
  }

  export default function login (state = INITIAL_STATE, action) {
    switch (action.type) {
//         case LOGIN: 
// // action.login(action.cellphone, action.passwd)
//         break
        case  LOGIN_SUCCESS:
            const { cellphone, userInfo, userId } = action.payload
            return {
              ...state, cellphone, userInfo, userId 
            }
 
        break;
        case BASICINFO:
            // console.log('i am here',action)
            return {
                ...state,
                basicinfo: action.payload
            } 
        // case LOGIN_FAIL:

        // break
        // case LOGOUT:

        // break;
        default:
          return state
    }
  }